package com.sto.stoapp.broadcast;

import java.util.LinkedList;
import java.util.List;

import android.app.Activity;

public class EixtToViewManager {
	private List<Activity> mList = new LinkedList<Activity>();

	private static EixtToViewManager instance;

	private EixtToViewManager() {

	}

	public synchronized static EixtToViewManager getInstance() {
		if (null == instance) {
			instance = new EixtToViewManager();
		}
		return instance;
	}

	public void addActivity(Activity activity) {
		mList.add(activity);
	}

	public void exit() {
		try {
			for (Activity activity : mList) {
				if (activity != null)
					activity.finish();
			}
			mList.clear();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void clearActivity() {
		if(mList.size() > 0){
			mList.clear();
		}
	}
}
